package com.cx.web.controller;

import com.alibaba.fastjson.JSON;
import com.cx.meta.dto.CxMusic;
import com.cx.meta.model.po.MusicQueryParams;
import com.cx.meta.model.vo.PageData;
import com.cx.service.MusicService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author flysand
 * @package com.cx.web.controller
 * @date 2021-11-16 22:55
 * @des MusicController:
 */
@RestController
@RequestMapping("/music")
public class MusicController {

    private final static Logger LOG = LoggerFactory.getLogger(MusicController.class);

    @Resource
    private MusicService musicService;

    @PostMapping("/getMusicByQueryParams")
    PageData<CxMusic> getMusicByQueryParams(@RequestBody MusicQueryParams queryParams) {
        LOG.debug("getMusicByQueryParams:" + JSON.toJSONString(queryParams));
        return musicService.getMusicByParams(queryParams);
    }
}
